package com.brradish.todo.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.brradish.todo.dao.PersonDAO;
import com.brradish.todo.model.Person;

@Controller
public class MainController {
	private static final Logger logger = LogManager.getLogger(MainController.class);

	@Autowired
	private PersonDAO personDAO;

	@RequestMapping(value = "/test")
	@ResponseBody
	public String test(HttpServletRequest request, HttpServletResponse response) {
		logger.debug("test");
		Person person = new Person();
		person.setName("Pankaj");
		person.setCountry("India");

		personDAO.save(person);

		return "OK";
	}

}
